﻿@model HQPad.Controllers.DashboardModel

<h1 class="with-control-box">Your dashboard</h1>
<ul class="control-box">
    <li class="import-character">@Html.ActionLink("Import", "Index", "CharacterImport", null, new { title = "import a character from an HQML file", @class = "calltoaction-link" })</li>
    <li class="character-new">@Html.ActionLink("New character", "New", "Character", null, new { title = "Add a new scratch pad character", @class = "calltoaction-link" })</li>
</ul>

<section class="content">
    <div class="block">
        <p class="first">If you have an existing saved character below you can <strong>load</strong> it into the scratch pad to make amendments.</p>
        <p>To create a new blank character click the <strong>new</strong> button above.</p>
        <p class="last">Any characters you have already loaded into the scratch pad are shown in the right side bar.  You can click on one
            to open it.
            <strong>Beware</strong>, If you make amendments on the scratch pad they will be lost at the end of your session unless 
            you <strong>save</strong> your character!
        </p>
    </div>

    <h2>Your saved characters</h2>

    @if (Model.Characters != null && Model.Characters.Count() > 0)
    {
        <table>
            <thead>
                <th>Name</th>
                <th>Date last saved</th>
                <th></th>
            </thead>
            <tbody>
                @foreach (var character in Model.Characters)
                {
                    <tr>
                        <td>@Html.Raw(character.CharacterName)</td>
                        <td>@Html.Raw(character.DateSaved.ToShortDateString())</td>
                        <td>@Html.ActionLink("Load", "Load", "Home", new { id = character.CharacterID }, null)</td>
                    </tr>
                }
            </tbody>
        </table>
    }
    else
    {
        <div class="block">
            <p class="first">You don't yet have any saved character.</p>
            <p class="last">Create a new scratch pad character or import one from an existing HQML file.  When you're happy with it you can save it for later.</p>
        </div>
    }
</section>

<section class="sidebar">
    <div class="sidebar-container">
        <h2>Current scratch pad</h2>
        <ul class="scratch-list">
            @foreach (var scratch in Model.ScratchPadCharacters)
            {
                <li>@Html.ActionLink(scratch.CharacterName, "Index", "Character", new { name = scratch.Slug }, new { @class = "name" }) 
                    <div class="right">@Html.ActionLink("Remove", "DeleteScratch", "Character", new { name = scratch.Slug }, new { @class = "remove-button" })</div>
                </li>
            }
        </ul>
    </div>
</section>
